﻿//======================================================================
//
//        Copyright (C) 2015   
//        All rights reserved
//
//        filename : PutOutAllocation
//        description : 半成品/成品卡调拨出库
//        created by XXX at  20150821
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CardLogistics.Web.Components;
using System.Data;

namespace CardLogistics.Web.MainPage.PutOutCard.PutOutAllocation
{
    public partial class Detail : BasePage
    {
        private static readonly CardLogistics.DAL.PutOutCard.PutOutAllocationData DAL = new DAL.PutOutCard.PutOutAllocationData();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void InitControl()
        {
            string _key = Request.QueryString["id"];
            WebUserControl_AppInfo1.InfoID = _key;
            WebUserControl_AppInfo1.UserID = LoggedUser.ID;
            {
                CardLogistics.Model.PutOutCard.PutOutAllocation pData = DAL.GetModel(_key);
                SetWebControls(this.Page, pData);
                if (pData!= null)
                {
                    //出库时间
                    if (pData.ALLOCATIONDATE != null)
                    {
                        ALLOCATIONDATE.Text = DateTime.Parse(pData.ALLOCATIONDATE.ToString()).ToString("yyyy-MM-dd");
                    }
                    //调拨出库详细
                    DataTable dt = DAL.GetInfoByOutAllocationId(pData.ID);
                    rptDetailList.DataSource = dt;
                    //根据卡号升序排列
                    dt.DefaultView.Sort = "StartNo ASC,EndNo ASC";
                    rptDetailList.DataBind();
                }
            }
        }
    }
}